package com.dy.springcloud.service;

import com.dy.springcloud.entity.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

//openfeign的核心
@Component//直接注入。可以获取登录代理对象
//value为服务提供集群的注册别名
//fallback 指定当调用超时，快速返回失败
@FeignClient(value = "member-service-nacos-provider",fallback = MemberFeignFallbackService.class)
public interface MemberOpenFeignService {

    //定义远程访问接口，@GetMapping("/member/get/{id}")，和参数是服务提供集群的controller接口方法中复制的
    //调用url为 http://member-service-nacos-provider/member/get/{id}
    @GetMapping("/member/get/{id}")
    public Result getMemberById(@PathVariable("id") Long id);
}
